package dal;

import java.util.*;

import model.*;

public class DalUtil {

	public static ProjectModel loadProject(int idProject) throws Exception {
		GenericDal<ProjectModel, ProjectModelExt> dal = new GenericDal<ProjectModel, ProjectModelExt>(new ProjectModel());
		ProjectModel query = new ProjectModel();
		query.setId(idProject);
		ProjectModel obj = dal.select(query);
		return obj;
	}

	public static VenueModel loadVenue(int idVenue) throws Exception {
		GenericDal<VenueModel, VenueModelExt> dal = new GenericDal<VenueModel, VenueModelExt>(new VenueModel());
		VenueModel query = new VenueModel();
		query.setId(idVenue);
		VenueModel obj = dal.select(query);
		return obj;
	}

	public static QuotationModel loadQuotation(int idQuotation) throws Exception {
		GenericDal<QuotationModel, QuotationModelExt> dal = new GenericDal<QuotationModel, QuotationModelExt>(new QuotationModel());
		QuotationModel query = new QuotationModel();
		query.setId(idQuotation);
		QuotationModel obj = dal.select(query);
		return obj;
	}

	public static List<PhaseModel> loadPhaseByProject(int idProject) throws Exception {
		GenericDal<PhaseModel, PhaseModelExt> dal = new GenericDal<PhaseModel, PhaseModelExt>(new PhaseModel());
		PhaseModelExt query = new PhaseModelExt();
		query.setIdProject(idProject);
		List<PhaseModel> list = dal.selectList(query);
		return list;
	}

	public static ChecklistModel loadChecklist(int idChecklist) throws Exception {
		GenericDal<ChecklistModel, ChecklistModelExt> dal = new GenericDal<ChecklistModel, ChecklistModelExt>(new ChecklistModel());
		ChecklistModel query = new ChecklistModel();
		query.setId(idChecklist);
		ChecklistModel obj = dal.select(query);
		return obj;
	}

	public static List<ChecklistItemModel> loadChecklistItems(int idChecklist) throws Exception {
		GenericDal<ChecklistItemModel, ChecklistItemModelExt> dal = new GenericDal<ChecklistItemModel, ChecklistItemModelExt>(new ChecklistItemModel());
		ChecklistItemModelExt query = new ChecklistItemModelExt();
		query.setIdChecklist(idChecklist);
		List<ChecklistItemModel> list = dal.selectList(query);
		return list;
	}

	public static List<ChecklistModel> loadChecklistByProject(int idProject) throws Exception {
		GenericDal<ChecklistModel, ChecklistModelExt> dal = new GenericDal<ChecklistModel, ChecklistModelExt>(new ChecklistModel());
		ChecklistModelExt query = new ChecklistModelExt();
		query.setIdProject(idProject);
		List<ChecklistModel> list = dal.selectList(query);
		return list;
	}

}
